﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spanner;

namespace SpannerWebSite
{
    internal partial class RefGlobals : Reference
    {
        internal static SpannerChapter TheChapter;

        static RefGlobals()
        {
            var sections = new List<SpannerSection> { };
            var initActs = new List<Act> { };

            Action<string, string, Html> addSection = (title, id, html) =>
            {
                sections.Add(Section(Esc(title), id, html));
            };

            addSection("Undefined", "Undefined", P(Code("Undefined<T>()"), " denotes the JavaScript ",
                Code("undefined"), " pertaining to the type ", Code("T"), "."));

            addSection("ToString", "ToString", P(Code("ToString(x)"), " denotes the JavaScript ",
                Code("x.toString()"), "."));

            addSection("DecodeUri", "DecodeUri", P(Code("DecodeUri(s)"), " denotes the JavaScript ",
                Code("decodeURI(s)"), "."));

            addSection("DecodeUriComponent", "DecodeUriComponent", P(Code("DecodeUriComponent(s)"), " denotes the JavaScript ",
                Code("decodeURIComponent(s)"), "."));

            addSection("EncodeUri", "EncodeUri", P(Code("EncodeUri(s)"), " denotes the JavaScript ",
                Code("encodeURI(s)"), "."));

            addSection("EncodeUriComponent", "EncodeUriComponent", P(Code("EncodeUriComponent(s)"), " denotes the JavaScript ",
                Code("encodeURIComponent(s)"), "."));

            addSection("Escape", "Escape", P(Code("Escape(s)"), " denotes the JavaScript ",
                Code("escape(s)"), "."));

            addSection("Unescape", "Unescape", P(Code("Unescape(s)"), " denotes the JavaScript ",
                Code("unescape(s)"), "."));

            TheChapter = CommonUI.Chapter("Reference - Globals", "RefGlobals", sections, initActs);
        }
    }
}
